//
//  FDBMainView.m
//  FDBSDK
//
//  Created by curer on 12/13/15.
//  Copyright © 2015 lion. All rights reserved.
//

#import "FDBMainView.h"
#import "FDBSDK.h"
#import "AGWindowView.h"

@implementation FDBMainView {
    UIButton *_button;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)init {
    if (self = [super init]) {
        _button = [UIButton buttonWithType:UIButtonTypeCustom];
        [_button setTitle:@"click me" forState:UIControlStateNormal];
        [_button setBackgroundColor:[UIColor redColor]];
        [_button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_button];
    }
    
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _button.frame = CGRectMake(0, 0, 50, 50);
}

- (void)buttonClicked:(UIButton *)btn {
    [FDBSDK sendFeedbackWithContent:@"TestTest"];
    [self hideMainView];
}

- (void)hideMainView {
    [self.container fadeOutAndRemoveFromSuperview:^{

    }];
}

@end
